home *** CD-ROM | disk | FTP | other *** search
/ QuickTime VR Showcase / QuickTime VR Showcase.iso / media / mScripts.Cxt / 00070_Text_VR Handlers from Prestige.txt
Encoding:
Text File  |  1996-12-29  |  30.4 KB  |  906 lines

  1. -- QTVR Handlers
  2.  
  3. --=============================================================================
  4. -- Routines for initializing and cleaning up the Director movie.
  5. -------------------------------------------------------------------------------
  6.  
  7. global gPanoMovie, gPathName, gLastTimeRollover, gPanoFrame, mediaPath, currNode, dbFlag, video, doubled, currLoc, currSpot, puppetList, onPC, exitPanList, termPanList, studioAngleList, gFrameScript, gStashedPanoData, currPano, gAtriumPanList, gPlaceList, gLastNode, vrPath, gSpotType, gClickList, gIsRack, gIntClipTimes, gLowMem, gMainMovie
  8.  
  9.  
  10. --=============================================================================
  11. -- StartMovie
  12. --
  13. -- Runs at movie start time.  Initializes key globals, calls machine specific 
  14. -- init handler.
  15. -------------------------------------------------------------------------------
  16. on init
  17.   put empty into gPanoMovie
  18.   put empty into gPathName
  19.   put false into gLastTimeRollover
  20.   put empty into gPanoFrame
  21.   set dbFlag = false
  22.   set video = false
  23.   set doubled = false
  24.   set puppetList = []
  25.   set the text of field "text box" = " "
  26.   --  set the foreColor of cast "text box" = 38
  27.   
  28.   set exitPanList = [#town:[300,-1,29], #hitf:[203,-4,32], #righ:[210,-5,36], #reco:[107,0,47], #larr:[134,3,29], #guil:[11,2,20], #chur:[191,3,23], #ocea:[101,-2,26], #wiss:[105,-2,17], #mast:[210,-1,26]]
  29.   
  30.   puppetIt 9
  31.   set gLastNode = 11
  32.   set gIsRack = 0
  33.   
  34.   set gClickList = [#equipt:[38,54],#staff:[22,38],#projects:[8,24],#profile:[0,10]]
  35.   
  36.   set studioAngleList = [#hitf:[274,4,69], #righ:[255,3,59], #reco:[230,3,66], #larr:[210,3,56], #guil:[190,3,71], #chur:[166,5,68], #ocea:[150,3,65], #wiss:[125,3,56], #town:[105,4,69], #mast:[81,3,65]]
  37.   
  38.   set termPanList = [#hitf:3, #righ:4, #reco:5, #larr:6, #guil:7, #chur:8, #ocea:9, #wiss:10,#town:11,#mast:12]
  39.   
  40.   set gAtriumPanList = [#interview:[3,180], #skyw:[3,0], #soli:[5,0], #terrace:[5,180], #c21:[7,0], #listen:[7,180], #elevator:[8,90], #adobe:[6,180], #apple:[2,0], #data:[2,180], #dmi:[4,180], #fwb:[4,0], #compuserve:[6,0], #macromedia:[8,0], #kaba:[8,180], #sound:[8,190], #mix:[8,300]]
  41.   
  42.   set gIntClipTimes = [[24667,27130], [0,3900], [3980,8281], [8370,9600], [9700,11318], [11368,13391], [13481,17286], [17346,20306], [20356, 22800], [22850, 24600]]
  43.   
  44.   put return & return
  45.   
  46.   -- startController
  47.   
  48.   global gPlaceList
  49.   set gPlaceList = [#1:"hitfVR", #2:"righVR", #3:"recoVR", #4:"larrVR", #5:"guilVR", #6:"churVR", #7:"oceaVR", #8:"wissVR", #9:"mastVR", #10:"townVR", #11:"Terminus", #12:"Listen", #13:"terrace", #14:"Interview", #15:"Atrium", #16:"c21", #18:"soli", #17:"SkywVR"]
  50.   
  51.   LoadRawPictIntoString
  52.   set gMainMovie = the PathName & "Prestige.Dir"
  53. end
  54.  
  55. on startMovie
  56.   set the visible of sprite 20 = false
  57.   set puppetList = []
  58.   if the machineType = 256 then initPC
  59.   else initMac
  60. end
  61.  
  62. --=============================================================================
  63. -- initMac & initPC
  64. --
  65. -- Machine-specific initialization handlers called from startMovie.
  66. -- Initializes key globals, opens the external code library, registers the 
  67. -- QuickTime VR components, and sets up the Callback Factory.
  68. -------------------------------------------------------------------------------
  69.  
  70. on initMac
  71.   set onPC = false
  72.   
  73.   -- Need to open up the external xlib so that we don't have the
  74.   -- XCMD floating-point bug problem when we save.
  75.   -- This would be commented out just before we turn this into a projector.
  76.   
  77.   openxlib "QuickTime VR XCMDs"
  78.   openXlib "Prestige Externals"
  79.   
  80.   InitializeMemory
  81.   checkMem
  82.   -- Register the QuickTime VR component
  83.   -- This would turn into RegisterComponent (":", empty) when the components are
  84.   -- embedded in the projector.
  85.   
  86.   -- RegisterComponent (":", empty)
  87.   RegisterComponent (the pathname & "QuickTime VR Components", empty)
  88.   
  89.   -- Need to set up the XCMD Callback Factory so that we can execute callbacks
  90.   -- to Lingo handlers from PanoMovie
  91.   
  92.   global gQTVRCallBackFactory
  93.   put CallBackTracer(mNew) into gQTVRCallBackFactory
  94.   SetCallBack PanoMovie,gQTVRCallBackFactory  
  95. end
  96.  
  97. on initPC
  98.   if gLowMem then
  99.     set mediaPath = the pathName & "lowmem\"
  100.   else
  101.     set mediaPath = the pathName
  102.   end if
  103.   
  104.   set onPC = true
  105.   
  106.   -- Need to open up the external xlib
  107.   openxlib "QTVRW.QTC"
  108.   
  109.   
  110.   -- Need to set up the XCMD Callback Factory so that we can execute callbacks
  111.   -- to Lingo handlers from PanoMovie
  112.   
  113.   global gPanoCallbackFactory, gTestCallbackFactory
  114.   put panoCallbacks(mNew) into gPanoCallbackFactory
  115. end
  116.  
  117. --=============================================================================
  118. -- StopMovie
  119. --
  120. -- Runs at movie stop time.  Closes any open pano or nav movies.  Disposes
  121. -- of the XCMD Callback Factory and closes the external code library.
  122. -------------------------------------------------------------------------------
  123. on stopMovie
  124.   -- Close any open panoramic or object movies
  125.   ClosePanoMovie
  126.   
  127.   -- Close the external XCMD library
  128.   -- This would be commented out just before we turn this into a projector.
  129.   closeXlib
  130.   
  131.   -- Dispose of the XCMD Callback Factory
  132.   global gQTVRCallBackFactory
  133.   if objectP(gQTVRCallBackFactory) then gQTVRCallBackFactory (mDispose)
  134. end
  135.  
  136. on leave
  137.   if objectp(ECDX)  then
  138.     stopcd
  139.     disposeECDX
  140.   end if
  141.   
  142.   -- Close any open panoramic or object movies
  143.   ClosePanoMovie
  144.   
  145.   -- Close the external XCMD library
  146.   -- This would be commented out just before we turn this into a projector.
  147.   closeXlib
  148.   
  149.   -- Dispose of the XCMD Callback Factory
  150.   global gQTVRCallBackFactory
  151.   if objectP(gQTVRCallBackFactory) then gQTVRCallBackFactory (mDispose)
  152.   
  153.   
  154.   clearGlobals
  155.   quit
  156. end
  157.  
  158. --=============================================================================
  159. -- Routines for managing panoramic movies
  160. -------------------------------------------------------------------------------
  161.  
  162.  
  163. --=============================================================================
  164. -- OpenPanoMovie
  165. --      pFilename is the full file path of the file
  166. --      pSpriteNum is the sprite associated with the direct Pano Movie
  167. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  168. --
  169. -- Opens the file pFileName as a panoramic movie, and sets up callback
  170. -- handlers as specified.  Updates the screen with the movie's default
  171. -- view if requested by pShowOnOpen
  172. -------------------------------------------------------------------------------
  173. on OpenPanoMovie pFileName, pSpriteNum, pShowOnOpen
  174.   global gPanoMovie, gPathName
  175.   
  176.   -- The use of a single global gPanoMovie constrains these routines 
  177.   -- to only allow one pano movie to be open at a time.
  178.   -- Close any other open pano movie.
  179.   ClosePanoMovie
  180.   
  181.   set theFile = mediaPath & pFileName
  182.   
  183.   if onPC then
  184.     set gPanoMovie = QTVRW (mNew, "Pan")
  185.     if not objectP(gPanoMovie) then
  186.       put "Unable to create new Pan instance"
  187.       beep
  188.       exit
  189.     end if
  190.     put gPanoMovie (mOpenMovie, theFile, the left of sprite pSpriteNum ¬¨
  191.       & "," & the top of sprite pSpriteNum) into tResultCode
  192.     if tResultCode = 0 then
  193.       put "Unable to open panomovie"
  194.       gPanoMovie (mDispose)
  195.       beep
  196.       exit
  197.     end if
  198.     set currNode = gPanoMovie (mGetNodeID)
  199.   else
  200.     cleanMem
  201.     -- Make the pano movie display in the rect covered by sprite pSpriteNum
  202.     put the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," &¬¨
  203.     the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum into tPanoRect
  204.     
  205.     put PanoMovie("openMovie", "Direct", theFile, tPanoRect) into gPanoMovie
  206.     if gPanoMovie contains "error" then
  207.       -- Display the error in the message window
  208.       put gPanoMovie
  209.       put empty into gPanoMovie
  210.       beep
  211.       exit
  212.     end if
  213.     set currNode = PanoMovie("Direct", gPanoMovie, "get", "nodeID")
  214.     -- directUpdate
  215.   end if
  216.   
  217.   -- put ExtractPathName(theFile) into gPathName
  218.   
  219.   InitPanoCallbacks
  220.   
  221.   if pShowOnOpen then
  222.     directUpdate
  223.   end if
  224. end OpenPanoMovie
  225.  
  226.  
  227. --=============================================================================
  228. -- InitPanoCallbacks
  229. --
  230. -- Initializes the callbacks used for panoramic movies.
  231. -------------------------------------------------------------------------------
  232. on InitPanoCallbacks
  233.   global gPanoMovie, gPanoCallbackFactory
  234.   if onPC then
  235.     if objectP(gPanoMovie) and objectP(gPanoCallbackFactory) then
  236.       -- Set up callback handlers for panoramic movies.  
  237.       
  238.       gPanoMovie(mSetRolloverCallback, gPanoCallbackFactory, "spotRoll")
  239.       
  240.     end if
  241.   else
  242.     if gPanoMovie <> empty then
  243.       -- Set up callback handlers for panoramic movies.  
  244.       
  245.       -- We reset each callback to empty if we're not setting it to a handler name;
  246.       
  247.       -- PanoMovie "Direct", gPanoMovie, "set", "rolloverHotSpotHandler", empty
  248.       PanoMovie "Direct", gPanoMovie, "set", "rolloverHotSpotHandler", "spotRollover"
  249.       
  250.       -- PanoMovie "Direct", gPanoMovie, "set", "nodeLeaveHandler", empty
  251.       -- PanoMovie "Direct", gPanoMovie, "set", "nodeLeaveHandler", "sampleNodeLeaveHandler"
  252.     end if
  253.   end if
  254. end InitPanoCallbacks
  255.  
  256. --=============================================================================
  257. -- directUpdate
  258. --
  259. -- Updates the pano movie display. 
  260. -------------------------------------------------------------------------------
  261. on directUpdate
  262.   if onPC then
  263.     gPanoMovie (mUpdate)
  264.   else
  265.     PanoMovie "Direct", gPanoMovie, "update"
  266.   end if
  267. end
  268.  
  269. --=============================================================================
  270. -- ShowPanoMovie
  271. --      [pQuality] is the quality level at which to display the update
  272. --
  273. -- Updates the pano movie display.  Has the side effect of changing
  274. -- the current quality level to pQuality, if specified.
  275. -------------------------------------------------------------------------------
  276. on ShowPanoMovie pQuality
  277.   global gPanoMovie
  278.   if onPC then
  279.     if objectP (gPanoMovie) then
  280.       if not voidP(pQuality) then gPanoMovie (mSetQuality, string(pQuality))
  281.       gPanoMovie (mUpdate)
  282.     end if
  283.   else
  284.     if gPanoMovie <> empty then
  285.       if not voidP(pQuality) then PanoMovie "Direct", gPanoMovie, "set", "quality", pQuality 
  286.       PanoMovie "Direct", gPanoMovie, "update"
  287.     end if
  288.   end if
  289. end ShowPanoMovie
  290.  
  291.  
  292. --=============================================================================
  293. -- SetPanoNode
  294. --      pNodeID is the number of the node to go to
  295. --      pUpdate is true if a screen update is to be performed
  296. --      [pQuality] is the quality level at which to display the update
  297. --
  298. -- Changes the current node as specified.  If pUpdate is true, updates the
  299. -- screen to reflect that node's default view.  Has the side effect of changing
  300. -- the current quality level to pQuality, if specified.
  301. -------------------------------------------------------------------------------
  302. on SetPanoNode pNodeID, pUpdate, pQuality
  303.   global gPanoMovie
  304.   if onPC then
  305.     if objectP (gPanoMovie) then
  306.       gPanoMovie (mSetNodeID, integer(pNodeID))
  307.       if not voidP(pQuality) then gPanoMovie (mSetQuality, string(pQuality))
  308.       gPanoMovie (mUpdate)
  309.     end if
  310.   else
  311.     if gPanoMovie <> empty then
  312.       PanoMovie "Direct", gPanoMovie, "set", "nodeID", pNodeID
  313.       if not voidP(pQuality) then PanoMovie "Direct", gPanoMovie, "set", "quality", pQuality 
  314.       if pUpdate then PanoMovie "Direct", gPanoMovie, "Update" 
  315.     end if
  316.   end if
  317.   
  318.   set currNode = pNodeID
  319. end SetPanoNode
  320.  
  321.  
  322. --=============================================================================
  323. -- SwingPanoMovie
  324. --      pHPan is the destination horizontal pan angle
  325. --      pVPan is the destination vertical pan angle
  326. --      pZoom is the destination zoom angle
  327. --      pSwingSpeed is the speed at which to swing
  328. --      pSwingQuality is the quality at which to swing
  329. --      pFinalQuality is the quality at which to re-update the destination view
  330. --
  331. -- Swings the view around to a specified direction.  Has the side effect of
  332. -- changing the current quality level to pFinalQuality
  333. -------------------------------------------------------------------------------
  334. on SwingPanoMovie pHPan, pVPan, pZoom, pSwingSpeed, pSwingQuality, pFinalQuality
  335.   global gPanoMovie
  336.   if onPC then
  337.     if objectP (gPanoMovie) then
  338.       -- Set up the destination pan and zoom angles
  339.       
  340.       gPanoMovie (mSetZoomAngle, string(pZoom))
  341.       gPanoMovie (mSetVPanAngle, string(pVPan))
  342.       gPanoMovie (mSetHPanAngle, string(pHPan))
  343.       
  344.       -- For performance, you can use lower quality during the swing
  345.       gPanoMovie (mSetQuality, string(pSwingQuality))
  346.       gPanoMovie (mSetTransitionMode, "swing")
  347.       gPanoMovie (mSetTransitionSpeed, string(pSwingSpeed))
  348.       gPanoMovie (mUpdate)
  349.       
  350.       -- Set transition mode to normal
  351.       gPanoMovie (mSetTransitionMode, "normal")
  352.       
  353.       -- Only do a reupdate if the quality values are different
  354.       if pFinalQuality <> pSwingQuality then
  355.         gPanoMovie (mSetQuality, string(pSwingQuality))
  356.         gPanoMovie (mUpdate)
  357.       end if
  358.     end if
  359.   else
  360.     if gPanoMovie <> empty then
  361.       -- debug "mac swingPanoMovie"
  362.       -- Set up the destination pan and zoom angles
  363.       PanoMovie "Direct", gPanoMovie, "set", "zoomAngle", pZoom 
  364.       PanoMovie "Direct", gPanoMovie, "set", "vPanAngle", pVPan
  365.       PanoMovie "Direct", gPanoMovie, "set", "hPanAngle", pHPan 
  366.       -- debug "set angles",0
  367.       
  368.       -- For performance, you can use lower quality during the swing
  369.       PanoMovie "Direct", gPanoMovie, "set", "quality", pSwingQuality
  370.       PanoMovie "Direct", gPanoMovie, "set", "transitionMode", "swing" 
  371.       PanoMovie "Direct", gPanoMovie, "set", "transitionSpeed", pSwingSpeed
  372.       -- debug "set qualities",0
  373.       
  374.       PanoMovie "Direct", gPanoMovie, "update"
  375.       
  376.       -- Set transition mode to normal
  377.       PanoMovie "Direct", gPanoMovie, "set", "transitionMode", "normal"
  378.       
  379.       -- Only do a reupdate if the quality values are different
  380.       if pFinalQuality <> pSwingQuality then
  381.         PanoMovie "Direct", gPanoMovie, "set", "quality", pFinalQuality 
  382.         PanoMovie "Direct", gPanoMovie, "update" 
  383.       end if
  384.     end if
  385.   end if
  386. end SwingPanoMovie
  387.  
  388.  
  389. --=============================================================================
  390. -- SetPanoMovieView
  391. --      pHPan is the destination horizontal pan angle
  392. --      pVPan is the destination vertical pan angle
  393. --      pZoom is the destination zoom angle
  394. --      [pQuality] is the quality at which to display the view
  395. --
  396. -- Displays a new view in the current node.  Has the side effect of changing
  397. -- the current quality level to pQuality, if specified.
  398. -------------------------------------------------------------------------------
  399. on SetPanoMovieView pHPan, pVPan, pZoom, pQuality
  400.   global gPanoMovie
  401.   if onPC then
  402.     if objectP (gPanoMovie) then
  403.       -- Set up the destination pan and zoom angles
  404.       
  405.       gPanoMovie (mSetZoomAngle, string(pZoom))
  406.       gPanoMovie (mSetVPanAngle, string(pVPan))
  407.       gPanoMovie (mSetHPanAngle, string(pHPan))
  408.       if not voidP(pQuality) then gPanoMovie (mSetQuality, string(pQuality))
  409.       gPanoMovie (mUpdate) 
  410.     end if
  411.   else
  412.     if gPanoMovie <> empty then
  413.       PanoMovie "Direct", gPanoMovie, "set", "zoomAngle", pZoom
  414.       PanoMovie "Direct", gPanoMovie, "set", "vPanAngle", pVPan
  415.       PanoMovie "Direct", gPanoMovie, "set", "hPanAngle", pHPan
  416.       if not voidP(pQuality) then PanoMovie "Direct", gPanoMovie, "set", "quality", pQuality 
  417.       PanoMovie "Direct", gPanoMovie, "update"
  418.     end if
  419.   end if
  420. end SetPanoMovieView
  421.  
  422.  
  423. --=============================================================================
  424. -- ClosePanoMovie
  425. --
  426. -- Disposes an open pano movie.  This does not remove the image from
  427. -- the screen.
  428. -------------------------------------------------------------------------------
  429. on ClosePanoMovie
  430.   global gPanoMovie
  431.   if onPC then
  432.     if objectP (gPanoMovie) then
  433.       -- debug "dispose"
  434.       gPanoMovie (mDispose)
  435.     end if
  436.   else
  437.     if gPanoMovie <> empty then
  438.       PanoMovie "Direct", gPanoMovie, "dispose"
  439.       put empty into gPanoMovie
  440.     end if
  441.   end if
  442.   cursor 200
  443.   cursor 0
  444. end ClosePanoMovie
  445.  
  446.  
  447.  
  448. --=============================================================================
  449. -- PanoFrameScript
  450. --
  451. -- When run frequently, provides cursor feedback over the pano movie
  452. -- and handles mouse down and keyboard actions.
  453. -------------------------------------------------------------------------------
  454. on PanoFrameScript 
  455.   set pSpriteNum = 4
  456.   if rollover(pSpriteNum) then
  457.     
  458.     set the text of cast "text box" = "Click and drag to move around."
  459.     -- Only run mouseOver if there's a movie AND Director is in the foreground
  460.     if onPC then
  461.       set isMovie = objectP (gPanoMovie)
  462.     else
  463.       if gPanoMovie <> empty and RunningInForeground() = "true" then 
  464.         set isMovie = true
  465.       end if
  466.     end if
  467.     
  468.     if isMovie then
  469.       --  repeat while rollover(pSpriteNum)
  470.       if onPC then
  471.         put gPanoMovie (mMouseOver) into tMouseOverResult
  472.       else
  473.         PanoMovie "Direct", gPanoMovie, "mouseOver"
  474.         put the result into tMouseOverResult
  475.       end if
  476.       
  477.       -- Result is 0 if you just wandered over the window
  478.       -- without mousing down, if you zoomed in or out without
  479.       -- mousing down, if you used the arrow keys, or if there
  480.       -- was an unhandled event
  481.       
  482.       if tMouseOverResult <> 0 then
  483.         put item 1 of tMouseOverResult into tAction
  484.         -- debug "tAction", tAction
  485.         if tAction = "jump" then
  486.           set gLastNode = currNode
  487.           put item 2 of tMouseOverResult into currNode
  488.           -- debug "currNode", currNode
  489.           if currLoc = "c21" then checkVideoButton
  490.           if currLoc = "skyw" then checkNodeMap
  491.           updateNodeMarker
  492.         else if tAction = "stil" then
  493.           put item 2 of tMouseOverResult into currSpot
  494.           -- popStil
  495.         else if tAction = "misc" then
  496.           put item 2 of tMouseOverResult into currSpot
  497.         else if tAction = "undf" then
  498.           put item 2 of tMouseOverResult into currSpot
  499.         else if tAction = "pan " then   -- Watch out for that space!
  500.           if gIsRack then 
  501.             unPopRack
  502.           end if
  503.         else if tAction = "goto" then
  504.           put item 2 of tMouseOverResult into currSpot
  505.         else if tAction = "exit" then
  506.           put item 2 of tMouseOverResult into currSpot
  507.           exitStudio
  508.         else if tAction = "kios" then
  509.           put item 2 of tMouseOverResult into currSpot
  510.           goKiosk
  511.         else if tAction = "stud" then
  512.           put item 2 of tMouseOverResult into currSpot
  513.           goStudio
  514.         else if tAction = "door" then
  515.           put item 2 of tMouseOverResult into currSpot
  516.           gotoAction
  517.         else if tAction = "fole" then
  518.           put item 2 of tMouseOverResult into currSpot
  519.           playSound
  520.         else if tAction = "rack" then
  521.           put item 2 of tMouseOverResult into currSpot
  522.           popRack
  523.         else if tAction = "shlf" then
  524.           put item 2 of tMouseOverResult into currSpot
  525.           popRack
  526.         end if
  527.         put true into gLastTimeRollover
  528.       else if rollover(pSpriteNum) then
  529.         -- There was an arrow key event or some unhandlable event,
  530.         -- but cursor is still over panoramic window
  531.         put true into gLastTimeRollover
  532.       else
  533.         -- The cursor is no longer over the panoramic window
  534.         
  535.         -- Set the cursor twice because Director tries to be smart and
  536.         -- doesn't change the cursor if your current cursor command
  537.         -- is the same as the last one.  It doesn't realize of course,
  538.         -- that QTVR has changed the cursor in between.
  539.         
  540.         -- KNOWN BUG: It appears that the cursor command is ignored if the mouse
  541.         -- is not over the stage, so if you move out of the movie window
  542.         -- fast enough and off the stage, the cursor will remain unchanged.
  543.         
  544.         cursor 200
  545.         cursor 0
  546.         
  547.         --        set the locV of sprite rollTextBg = -1000
  548.         --        set the locV of sprite rollTextFld = -1000
  549.         
  550.         put false into gLastTimeRollover
  551.       end if
  552.       -- end repeat
  553.     end if
  554.   else if gLastTimeRollover then
  555.     -- See comment(s) above
  556.     cursor 200
  557.     cursor 0
  558.     set the cursor of sprite 18 = [218]
  559.     put false into gLastTimeRollover
  560.     -- Allow a high quality update in pano window if needed
  561.     if onPC then
  562.       if objectP(gPanoMovieObj) then 
  563.         gPanoMovieObj(mIdle)
  564.       end if
  565.     else
  566.       if gPanoMovie <> empty then
  567.         PanoMovie "Direct", gPanoMovie, "idle"
  568.       end if
  569.     end if
  570.   end if
  571. end PanoFrameScript
  572.  
  573.  
  574.  
  575. --=============================================================================
  576. -- jumpNode
  577. --     
  578. -- Jumps to a new node, keeping the orientation from the old node.
  579. -- Called by mouseUp in node buttons on node map.
  580. -------------------------------------------------------------------------------
  581.  
  582. on jumpNode newNode
  583.   -- debug "newNode", newNode
  584.   if voidP(newNode) then 
  585.     -- determine which node user has clicked on
  586.     set nodeSprite = the clickOn
  587.     set newNode = nodeSprite - 30
  588.   else
  589.     -- didn't come from a click
  590.     set nodeSprite = newNode + 30
  591.   end if
  592.   
  593.   -- debug "nodeSprite", nodeSprite
  594.   -- debug "newNode", newNode
  595.   set currNode = newNode
  596.   updateNodeMarker
  597.   -- stash angles from old node
  598.   if onPC then
  599.     set zoom =  gPanoMovie (mGetZoomAngle)
  600.     set vert =  gPanoMovie (mGetVPanAngle)
  601.     set horiz = gPanoMovie (mGetHPanAngle)
  602.   else
  603.     set zoom =  PanoMovie("Direct", gPanoMovie, "get", "zoomAngle")
  604.     set vert =  PanoMovie("Direct", gPanoMovie, "get", "vPanAngle")
  605.     set horiz = PanoMovie("Direct", gPanoMovie, "get", "hPanAngle")
  606.   end if
  607.   
  608.   -- jump to new node, but don't display
  609.   setPanoNode newNode, false
  610.   
  611.   -- set angles to match old node's & update
  612.   setPanoMovieView horiz, vert, zoom
  613.   
  614.   if currLoc = "c21" then checkVideoButton
  615.   if currLoc = "skyw" then checkNodeMap
  616.   
  617. end
  618.  
  619. on updateNodeMarker
  620.   set markerSprite = 48
  621.   puppetIt markerSprite
  622.   
  623.   set nodeSprite = currNode + 30
  624.   
  625.   set the locH of sprite markerSprite = the locH of sprite nodeSprite
  626.   set the locV of sprite markerSprite = the locV of sprite nodeSprite
  627.   updatestage
  628. end
  629.  
  630. --=============================================================================
  631. -- PanoMovie callback handler routines
  632. -------------------------------------------------------------------------------
  633.  
  634. factory panoCallbacks
  635.   
  636. method spotRoll pHotSpotID
  637.   --  put "method spotRoll"
  638.   -- deBug "pHotSpotID", pHotSpotID
  639.   spotRollover pHotSpotID
  640.   --  if not voidP(pHotSpotID) then
  641.   --    gPanoMovie (mSetHotSpotID, pHotspotID)
  642.   --    set spotname = gPanoMovie (mGetHotSpotName)
  643.   --    set gSpotType = gPanoMovie (mGetHotgSpotType)
  644.   --    if gSpotType = "stil" or gSpotType = "navg" or gSpotType = "stud" or gSpotType = "door" or gSpotType = "kios" then
  645.   --      put spotName into field "text box"
  646.   --    end if
  647.   --    deBug "spotName", spotName
  648.   --    deBug "gSpotType", gSpotType
  649.   --  else
  650.   --    -- if pHotSpotID = 0 then 
  651.   --    put " " into field "text box"
  652.   --  end if
  653. end
  654.  
  655. --=============================================================================
  656. -- spotRollover
  657. --      pHotSpotID is the id of the hot spot the user is over
  658. --
  659. -- Called by PanoMovie whenever the hot spot the cursor is over changes.
  660. -------------------------------------------------------------------------------
  661. on spotRollover pHotSpotID
  662.   -- debug "pHotSpotID", pHotSpotID
  663.   if onPC then
  664.     gPanoMovie (mSetHotSpotID, pHotspotID)
  665.     set spotname = gPanoMovie (mGetHotSpotName)
  666.     set gSpotType = gPanoMovie (mGetHotSpotType)
  667.   else
  668.     PanoMovie "Direct", gPanoMovie, "set", "hotSpotID", pHotSpotID
  669.     set gSpotType = PanoMovie("Direct", gPanoMovie, "get", "hotSpotType")
  670.     set spotName = PanoMovie("Direct", gPanoMovie, "get", "hotSpotName")
  671.   end if
  672.   -- debug "spotName", spotName
  673.   -- debug "gSpotType", gSpotType
  674.   
  675.   if gSpotType = "stil" or gSpotType = "misc"  or gSpotType = "navg" then
  676.     put spotName into field "text box"
  677.   end if
  678.   
  679.   if gSpotType = "stud" then
  680.     set studList = [#chur:"The Church Studios", #ocea:"Ocean Way Recording", #larr:"Larrabee Sound Studios", #reco:"Record Plant", #hitf:"The Hit Factory", #righ:"Right Track Recording", #mast:"Masterfonics", #wiss:"Wisseloord", #guil:"Studio Guillaume Tell", #town:"The Town House"]
  681.     put "Click to transport to " & getAProp(studList, spotName) & "." into field "text box"
  682.   end if
  683.   
  684.   if gSpotType = "exit" then
  685.     if spotName = "Atr From Sky" then put "Click to return to the Atrium." into field "text box"
  686.     if spotName = "Terminus" then put "Click to return to the Studio Terminus." into field "text box"
  687.   end if
  688.   
  689.   if gSpotType = "door" then
  690.     if spotname = "elevUp" then put "Click to take the elevator to the Atrium" into field "text box"
  691.     else put "Click to" && spotName into field "text box"
  692.   end if
  693.   
  694.   if gSpotType = "rack" then
  695.     put "Click for a list of the contents of this rack." into field "text box"
  696.   end if
  697.   
  698.   if gSpotType = "shlf" then
  699.     put "Click for a list of the contents of this shelf." into field "text box"
  700.   end if
  701.   
  702.   if gSpotType = "fole" then put "Click to hear what this surface sounds like." into field "text box"
  703.   
  704.   if gSpotType = "link" and currLoc = "skyw" then
  705.     put "Click to" && spotName into field "text box"
  706.   end if
  707.   
  708.   if gSpotType = "kios" then put "Click on this kiosk to find out more about" && spotName & "." into field "text box"
  709.   
  710.   if pHotSpotID = 0 then put " " into field "text box"
  711. end
  712.  
  713.  
  714. on gotoAction
  715.   if onPC then
  716.     set spotname = gPanoMovie (mGetHotSpotName)
  717.   else
  718.     set spotName = PanoMovie("Direct", gPanoMovie, "get", "hotSpotName")
  719.   end if
  720.   -- closePanoMovie
  721.   cursor 200
  722.   cursor 0
  723.   unPuppetAll
  724.   -- deBug "spotName", spotName
  725.   go spotName
  726. end
  727.  
  728. on playSound
  729.   set soundList = ["foleMetal","foleAsphault","foleMarble", "foleSnow","foleDirt","foleCreakyporch","foleWoodfloor","foleMetal","foleGravel","foleCobblestone","foleSand","foleSand","foleGrate","foleLinoleum","foleSand","foleTile","foleCobblestone","foleCobblestone","foleDock","foleSand"]
  730.   
  731.   set temp =  getAt(soundList,integer(currSpot - 100))
  732.   -- debug "current Sound:", temp
  733.   puppetSound temp
  734.   updateStage
  735.   -- debug "currSpot for foley", currSpot
  736. end
  737.  
  738.  
  739. on exitStudio
  740.   if onPC then
  741.     set spotname = gPanoMovie (mGetHotSpotName)
  742.   else
  743.     set spotName = PanoMovie("Direct", gPanoMovie, "get", "hotSpotName")
  744.   end if
  745.   -- deBug "spotName", spotName
  746.   set exitFrameName = currLoc & "Exit"
  747.   -- deBug "exitFrameName" , exitFrameName
  748.   go exitFrameName
  749. end
  750.  
  751. on panToExit
  752.   set anglesList = getAProp(exitPanList, currLoc)
  753.   
  754.   put anglesList
  755.   set hPan = getAt(anglesList, 1)
  756.   set vPan = getAt(anglesList, 2)
  757.   set zoom = getAt(anglesList, 3)
  758.   
  759.   SwingPanoMovie hPan, vPan, zoom, 3, 1, 1
  760. end
  761.  
  762. on returnToTerminus
  763.   set the locV of sprite 28 = -1000
  764.   set the locV of sprite 29 = -1000
  765.   unPuppetAll
  766.   puppetTransition 9, 2, 24
  767.   go label("Terminus") +1
  768.   set currPano = "TermPano.mov"
  769.   
  770.   openPanoMovie currPano, 4, false
  771.   set nodeNumber = getAProp(termPanList,currLoc)
  772.   SetPanoNode nodeNumber, 1  
  773.   set currLoc = "terminus"
  774.   updateNodeMarker
  775. end
  776.  
  777. on returnToAtrium
  778.   unPuppetAll
  779.   go "Atrium 2"
  780.   set currPano = "AtrPano.mov"
  781.   openPanoMovie currPano, 4, false
  782.   -- deBug "currloc", currLoc
  783.   set currList = getAProp(gAtriumPanList, currLoc)
  784.   -- deBug "currlist", currList
  785.   set nodeNumber = getAt(currList,1)
  786.   set hPan = getAt(currList, 2)
  787.   set currLoc = "Atrium"
  788.   SetPanoNode nodeNumber, 0
  789.   SetPanoMovieView hPan, 0, 56
  790.   updateNodeMarker
  791. end
  792.  
  793. on goStudio
  794.   unPuppetAll
  795.   if onPC then
  796.     set spotname = gPanoMovie (mGetHotSpotName)
  797.   else
  798.     set spotName = PanoMovie("Direct", gPanoMovie, "get", "hotSpotName")
  799.   end if
  800.   set currLoc = spotName
  801.   go "zoom"
  802. end
  803.  
  804. on goKiosk
  805.   stashPanoData
  806.   unPuppetAll
  807.   if onPC then
  808.     set spotname = gPanoMovie (mGetHotSpotName)
  809.   else
  810.     set spotName = PanoMovie("Direct", gPanoMovie, "get", "hotSpotName")
  811.   end if
  812.   closePanoMovie
  813.   set currLoc = word 1 of spotName
  814.   unload
  815.   preLoad currLoc, currLoc
  816.   go currLoc
  817.   
  818.   cursor 200
  819.   cursor 0
  820. end
  821.  
  822.  
  823. on stashPanoData
  824.   if onPC then
  825.     set gStashedPanoData = [gPanoMovie (mGetHPanAngle), gPanoMovie (mGetVPanAngle), gPanoMovie (mGetZoomAngle)]
  826.   else
  827.     set gStashedPanoData = [PanoMovie("Direct", gPanoMovie, "get", "hpanAngle"), PanoMovie("Direct", gPanoMovie, "get", "vpanAngle"),PanoMovie("Direct", gPanoMovie, "get", "zoomAngle")]
  828.   end if
  829. end
  830.  
  831. on restorePano
  832.   -- deBug "restore: currNode", currNode
  833.   set oldCurrNode = integer(currNode)
  834.   
  835.   openPanoMovie currPano, 4, false
  836.   setPanoNode oldCurrNode, false
  837.   
  838.   -- deBug "restore 2: currNode", currNode
  839.   
  840.   set hPan = getAt(gStashedPanoData, 1)
  841.   set vPan = getAt(gStashedPanoData, 2)
  842.   set zoom = getAt(gStashedPanoData, 3)
  843.   
  844.   setPanoMovieView hPan, vPan, 56
  845.   
  846.   if currLoc = "skyw" then checkNodeMap
  847.   updateNodeMarker
  848. end
  849.  
  850. on popRack
  851.   set gIsRack = true
  852.   set textSprite = 1
  853.   set textCast = the number of cast (currLoc && "rack" && currSpot)
  854.   setText #equipt
  855.   set the castNum of sprite textSprite = textCast
  856.   updateStage
  857.   
  858.   repeat while the mouseDown
  859.     updatestage
  860.   end repeat
  861. end
  862.  
  863. on unPopRack
  864.   setText #equipt
  865.   set gIsRack = false
  866. end
  867.  
  868. --=============================================================================
  869. -- XCMD Callback Factory
  870. -------------------------------------------------------------------------------
  871.  
  872.  
  873.  
  874. --=============================================================================
  875. -- CallBackTracer
  876. --
  877. -- As described in "Using Lingo", Appendix A.  Pass any mSendCardMessage
  878. -- commands on to Lingo so that callbacks can be handled.
  879. -------------------------------------------------------------------------------
  880. factory CallBackTracer
  881.   
  882. method mNew
  883.   
  884. method mEvalExpr pExpr
  885.   
  886. method mSendHCMessage pMessage
  887.   
  888. method mSendCardMessage pMessage
  889.   do pMessage
  890.   
  891. method mGetFieldByName pCard, pName
  892.   
  893. method mGetFieldByNum pCard, pNum
  894.   
  895. method mGetFieldByID pCard, pID
  896.   
  897. method mSetFieldByName pCard, pName, pValue
  898.   
  899. method mSetFieldByNum pCard, pNum, pValue
  900.   
  901. method mSetFieldByID pCard, pID, pValue
  902.   
  903. end
  904.  
  905.  
  906.